<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录</title>

    <link href="/Public/wxCMS/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/wxCMS/css/datepicker3.css" rel="stylesheet">
    <link href="/Public/wxCMS/css/styles.css" rel="stylesheet">

    <!--[if lt IE 9]>
    <script src="/Public/wxCMS/js/html5shiv.js"></script>
    <script src="/Public/wxCMS/js/respond.min.js"></script>
    <![endif]-->

</head>

<body>

<div class="row">
    <div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-4 col-md-offset-4">
        <div class="login-panel panel panel-default">
            <div class="panel-heading">登录</div>
            <div class="panel-body">

                    <fieldset>
                        <div class="form-group">
                            <input class="form-control" id="name" placeholder="用户名" name="name" type="text" autofocus="">
                        </div>
                        <div class="form-group">
                            <input class="form-control" id="password" placeholder="登录密码" name="password" type="password" value="">
                        </div>
                        <button type="button" id="login" class="btn btn-primary">登录</button>
                    </fieldset>
            </div>
        </div>
    </div><!-- /.col-->
</div><!-- /.row -->



<script src="/Public/wxCMS/js/jquery-1.11.1.min.js"></script>
<script src="/Public/wxCMS/js/bootstrap.min.js"></script>
<script src="/Public/wxCMS/js/layer.js" type="text/javascript"></script>
<!--<script src="/Public/wxCMS/js/chart.min.js"></script>
<script src="/Public/wxCMS/js/chart-data.js"></script>
<script src="/Public/wxCMS/js/easypiechart.js"></script>
<script src="/Public/wxCMS/js/easypiechart-data.js"></script>
<script src="/Public/wxCMS/js/bootstrap-datepicker.js"></script>-->
<script>
    !function ($) {
        $(document).on("click","ul.nav li.parent > a > span.icon", function(){
            $(this).find('em:first').toggleClass("glyphicon-minus");
        });
        $(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
    }(window.jQuery);

    $(window).on('resize', function () {
        if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
    })
    $(window).on('resize', function () {
        if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
    })
    $('#login').click(function(){
        var name=$('#name').val();
        var password=$('#password').val();
        if(name==''){
            layer.msg('请输入用户名');return;
        }
        if(password==''){
            layer.msg('请输入密码');return;
        }
        $.post('<?php echo U("loginAction");?>',{name:name,password:password},function(result){
                if(result.success){
                    layer.msg(result.message,{time:3000},function(){
                       window.location.href="<?php echo U('Home/Index/index');?>";
                    });
                }else{
                    layer.msg(result.message)
                }
        });

    });
</script>
</body>

</html>